import 'package:base_flutter_project/model/model.dart';
import 'package:flutter/material.dart';
import 'webview.dart';

class LocalNavWidget extends StatelessWidget {

  final List<LocalNavList> localList;

  LocalNavWidget({Key key, @required this.localList}) : super(key : key);
  Widget build(BuildContext context) {
    return Container(
      height: 64,
      margin: const EdgeInsets.only(top: 16),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: _createItems(context),
      ),
    );
  }

  List<Widget> _createItems(BuildContext context) {
    if(localList == null) return null;
    List<Widget> list = [];
    localList.forEach((val){
      list.add(
        GestureDetector(
          onTap: (){
            // print(val.title);
            Navigator.of(context).push(MaterialPageRoute(builder: (contenxt) => Webview(url: val.url,)));
          },
          child: Column(
            children: <Widget>[
              Image.network(val.icon, height: 44,),
              Text(val.title)
            ],
          ),
        )
      );
    });

    return list;
  }
}

class GirdNaviWidget extends StatelessWidget {

  final GridNav gridNavModel;
  GirdNaviWidget({Key key, this.gridNavModel}): super(key : key);

  _gridNavItem(BuildContext context, Hotel sender){
    List<Widget> items = [];
    
  }

  _gridNavItems(BuildContext context){
    List<Widget> items = [];
    if(gridNavModel == null) return items;
    if(gridNavModel.hotel != null) {

    }
    if(gridNavModel.flight != null) {
      
    }
    if(gridNavModel.travel != null) {
      
    }
  }


  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[],
    );
  }
}

